package cn.sumpu.app.guoguojie.biz;

import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import cn.sumpu.app.guoguojie.domain.CmsContent;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;
import cn.sumpu.app.guoguojie.util.PageModel;
import freemarker.template.TemplateException;

public interface CmsContentBiz {

    //添加内容
    void addCmsContent(CmsContent cmsContent) throws AppBusinessException;

    //取得内容列表
    List<CmsContent> getContentList(String channel, Integer number) throws AppBusinessException;

    //根据频道集合取得内容Id集合
    List<String> getContentIdList(String channelIdList) throws AppBusinessException;

    //更新内容信息
    void updateContentById(CmsContent cmsContent) throws AppBusinessException;

    //根据该频道下有多少条内容
    Integer getContentCount(String channelId) throws AppBusinessException;

    // 根据内容Id取得这条内容的信息
    CmsContent getContentById(String identifier) throws AppBusinessException;

    //根据内容Id的集合删除内容
    void deleteContentByIdList(String contentIdList) throws AppBusinessException;

    //根据内容Id删除内容
    void deleteContentById(String identifier) throws AppBusinessException;

    //维护编号(type：null.全频道维护 1.删除维护(-1) 2.排序上移(+1) 3.排序下移(-1))
    void updateContentSort(String channelId, Integer sort, Integer type, Integer pos1, Integer pos2) throws AppBusinessException;

    //全部更新为已发布
    void updateContentAll(String channelId) throws AppBusinessException;

    //预约发布内容
    void orderContent(CmsContent cmsContent);

    //取得后台的内容列表
    PageModel getBackContentList(String channel, String systemTag, Integer page, String title, String description, String nickname) throws AppBusinessException;

    //按照时间预览取得内容列表
    List<CmsContent> getContentListByTime(String channel, Date time, Integer number) throws AppBusinessException;

    //编号对调
    void updateContentBySort(String channelId, String contentId, Integer sort2) throws AppBusinessException;

    //查询这条微博有没有已经被推送
    int getTblIdentifierCount(String tblIdentifier, String channel) throws AppBusinessException;

    //更改封面
    void updateTagCover(String channel, String tagCover) throws AppBusinessException;

    //首页的格子
    List<CmsContent> getProductGrid(String sql) throws AppBusinessException;

    //这个频道下的所有内容排序都+1
    void updateContentAddOne(String channel) throws AppBusinessException;

    //批量预约
    void orderAllCmsContent(List<CmsContent> content, String orderTime) throws AppBusinessException;

    //查询爱心社活动
    List<CmsContent> getLoveActivity(String channel, Integer number) throws AppBusinessException;

    public void getIndexCmsContent(HttpServletRequest request) throws AppBusinessException;

    /**
     * author BruceZhang
     * @param channel	频道ID
     * @return	根据频道ID查询这个频道下最小序号
     * @throws AppBusinessException
     */
    Integer getMinSortByChannel(String channel) throws AppBusinessException;

    /**
     * author BruceZhang
     * @param channel	频道ID
     * @return	根据频道ID查询这个频道下最大序号
     * @throws AppBusinessException
     */
    Integer getMaxSortByChannel(String channel) throws AppBusinessException;

    /**
     * author Damon
     * @param table
     * @param tableId
     * @return
     * @throws AppBusinessException
     */
    public CmsContent getContentByTable(String table, String tableId, String channel) throws AppBusinessException;

    /**
     * author Damon
     * 帮淘页面
     * @return
     * @throws AppBusinessException
     */
    public List<CmsContent> getAmoysList(Integer pageSize) throws AppBusinessException;

    /**
     * 列表页帮淘
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public List<CmsContent> getCmsContentListForAmoy(Map<String, Object> map) throws AppBusinessException;
    public int getCmsContentListForAmoyCount(Map<String, Object> map) throws AppBusinessException;
    
    public void pushContent(HttpServletRequest request)throws AppBusinessException;
}
